package Logicamente;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.GridBagLayout;
import javax.swing.JComboBox;
import java.awt.GridBagConstraints;
import javax.swing.JButton;
import java.awt.Insets;
import javax.swing.JLabel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import java.awt.Toolkit;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class VentanaEstadisticas extends JFrame {

	private JPanel contentPane;
	private VentanaProfesor ventanaPadre;
	
	{
		//Set Look & Feel
		try {
			javax.swing.UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
		} catch(Exception e) {
			e.printStackTrace();
		}
	}


	/**
	 * Create the frame.
	 */
	public VentanaEstadisticas(VentanaProfesor v) {
		setTitle("Logicamente");
		ventanaPadre = v;
		setIconImage(Toolkit.getDefaultToolkit().getImage(VentanaEstadisticas.class.getResource("/Imagenes/L.png")));
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 576, 450);
		contentPane = new JPanelConFondo("/Imagenes/fondo.jpg");
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JPanel panel = new JPanelConFondo("/Imagenes/fondo_t.png");
		contentPane.add(panel, BorderLayout.CENTER);
		GridBagLayout gbl_panel = new GridBagLayout();
		gbl_panel.columnWidths = new int[]{0, 30, 0, 0};
		gbl_panel.rowHeights = new int[] {0, 40, 30, 0, 0, 0, 30, 0};
		gbl_panel.columnWeights = new double[]{100.0, 50.0, 50.0, Double.MIN_VALUE};
		gbl_panel.rowWeights = new double[]{100.0, 0.0, 100.0, 0.0, 15.0, 50.0, 100.0, Double.MIN_VALUE};
		panel.setLayout(gbl_panel);
		
		JComboBox comboBox = new JComboBox();
		comboBox.setModel(new DefaultComboBoxModel(new String[] {"Seleccionar partida", "TEO19", "ROMAN10"}));
		GridBagConstraints gbc_comboBox = new GridBagConstraints();
		gbc_comboBox.anchor = GridBagConstraints.WEST;
		gbc_comboBox.insets = new Insets(0, 0, 5, 5);
		gbc_comboBox.gridx = 1;
		gbc_comboBox.gridy = 1;
		panel.add(comboBox, gbc_comboBox);
		
		JLabel label = new JLabel("");
		label.setIcon(new ImageIcon(VentanaEstadisticas.class.getResource("/Imagenes/tabla_estadistica.png")));
		GridBagConstraints gbc_label = new GridBagConstraints();
		gbc_label.insets = new Insets(0, 0, 5, 5);
		gbc_label.gridx = 1;
		gbc_label.gridy = 3;
		panel.add(label, gbc_label);
		
		JLabel lblVolver = new JLabel("Volver");
		GridBagConstraints gbc_lblVolver = new GridBagConstraints();
		gbc_lblVolver.fill = GridBagConstraints.HORIZONTAL;
		gbc_lblVolver.insets = new Insets(0, 0, 5, 5);
		gbc_lblVolver.gridx = 1;
		gbc_lblVolver.gridy = 4;
		panel.add(lblVolver, gbc_lblVolver);
		
		JButton button = new JButton("");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				actionVolver(arg0);
			}
		});
		button.setIcon(new ImageIcon(VentanaEstadisticas.class.getResource("/Imagenes/boton_volver_f.png")));
		GridBagConstraints gbc_button = new GridBagConstraints();
		gbc_button.anchor = GridBagConstraints.WEST;
		gbc_button.insets = new Insets(0, 0, 5, 5);
		gbc_button.gridx = 1;
		gbc_button.gridy = 5;
		panel.add(button, gbc_button);
	}
	
	protected void actionVolver(ActionEvent arg0)
	{
		ventanaPadre.setVisible(true);
		this.setVisible(false);
		this.hide();
	}

}
